package objects;

import helpers.GamerThread;

import java.util.Vector;

public class Player {

	public enum Status {
		   NORMAL, OPEN, ONELEFT, FINISHED
	}
	
	private Status status;
	
	private String name;
	
	private GamerThread gameThread;
	
	private Vector<Domino> dominoSet;

	public Vector<Domino> getDominoSet() {
		return dominoSet;
	}

	public void setDominoSet(Vector<Domino> dominoSet) {
		this.dominoSet = dominoSet;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public GamerThread getGameThread() {
		return gameThread;
	}

	public void setGameThread(GamerThread gameThread) {
		this.gameThread = gameThread;
	}
        
        public int verifyMove(int f, int s, Vector<Domino> vec)
        {
            int resp = 0;
            if(vec.size() == 0)
            {
                if(f==12)
                    resp = 1;
                if(s==12)
                    resp = 2;
                System.out.println("vectorrr if: "+vec.size()+" resp: "+resp+" pos1:"+f+" pos2: "+s);
            }
            else
            {
                Domino d = vec.get(vec.size()-1);
                if(d.getSecond()==f)
                {
                    resp = 1;
                }
                if(d.getSecond()==s)
                {
                    resp = 2;
                }
                System.out.println("vectorrr else: "+vec.size()+" resp: "+resp+" pos1:"+d.getFirst()+" pos2: "+d.getSecond());
            }
            
            return resp;
        }
	
	public String getDominoSetAsString(){
		String result = "";
		if (this.getDominoSet()!= null){
			for(Domino d: this.getDominoSet()){
				result=result.concat("["+String.valueOf(d.getFirst())+","+String.valueOf(d.getSecond())+"]");				
			}
		}
		
		return result;
		
	}
	
	
}
